Welcome Guest | Sign in | Register

Home > C Programming > Defining Variables > Questions and Answers

01. What will be output of following c program ?
#include
main()
{
int class = 150;
int public =25;
int private=30;
class = class>>private-public;
printf(ā€œ%dā€,class);
}
A. 1 B. 2
C. 4 D. Compilation error

Answer and Explanation

Answer: 4

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
02. If a variable is declared as above, can it be accessed from another file?
A. Yes; it can be referenced. B. No; it should be declared as a static variable.
C. No; it should be declared using the global keyword D. Yes; it can be referenced through the publish specifier.
E. Yes; it can be referenced through the extern specifier.

Answer and Explanation

Answer: No; it should be declared using the global keyword

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
03. Which one of the following statements will properly initialize the variable t with the current time from the sample above?
A. t = clock(); B. time( &t );
C. t = ctime(); D. t = localtime();
E. None of the above

Answer and Explanation

Answer: t = clock();

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
04. What does the "auto" specifier do?
A. It automatically initializes a variable to 0;. B. It indicates that a variable's memory will automatically be preserved.
C. It automatically increments the variable when used. D. It automatically initializes a variable to NULL.
E. It indicates that a variable's memory space is allocated upon entry into the block.

Answer and Explanation

Answer: It indicates that a variable's memory will automatically be preserved.

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
05. Which one of the following variable names is NOT valid?
A. go_cart B. go4it
C. 4season D. run4
E. _what

Answer and Explanation

Answer: 4season

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
06. How is a variable accessed from another file?
A. The global variable is referenced via the extern specifier. B. The global variable is referenced via the auto specifier.
C. The global variable is referenced via the global specifier. D. The global variable is referenced via the pointer specifier.
E. The global variable is referenced via the ext specifier.

Answer and Explanation

Answer: The global variable is referenced via the extern specifier.

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
07. Global variables that are declared static are ____________.
Which one of the following correctly completes the sentence above? 
A. Deprecated by Standard C B. Internal to the current translation unit
C. Visible to all translation units D. Read-only subsequent to initialization
E. Allocated on the heap

Answer and Explanation

Answer: Allocated on the heap

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum



Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.